package com.lanou.tk.tourism.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.lanou.tk.tourism.R;

/**
 * Created by dllo on 15/10/24.
 */
public class RecommendRvWeb extends Activity{
    private WebView webView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.web_rv_recommend);

        webView = (WebView) findViewById(R.id.recommend_Rv_web);


        Intent intent = getIntent();
        String url = intent.getStringExtra("view_author_url");

        webView.loadUrl(url);



        //设置对象
        WebSettings settings = webView.getSettings();
        //设置是否能识别js语言
        settings.setJavaScriptEnabled(true);
        //是否支持缩放
        settings.setSupportZoom(true);
        /** 监听浏览器引擎 **/
        webView.setWebChromeClient(new WebChromeClient(){
            public void onProgressChanged(WebView view, int newProgress) {

                super.onProgressChanged(view, newProgress);
                Log.i("lanou","当前页面加载进度: " + newProgress);

            }

        });
        /** 监听接收到错误信息的回调 **/
        webView.setWebViewClient(new WebViewClient() {
            @Override
            public void onReceivedError(WebView view, int errorCode,
                                        String description, String failingUrl) {
                // TODO Auto-generated method stub
                super.onReceivedError(view, errorCode, description, failingUrl);
                Log.i("lanou", errorCode + " " + description);
            }


        });

    }


    }

